#!/bin/bash
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
if [ $? = 0 ];then
echo "导入ELRepo仓库的公共密钥完成"
else
echo "导入ELRepo仓库的公共密钥失败,正在退出..."
exit 1
fi
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
if [ $? = 0 ];then
echo "安装ELRepo仓库的yum源完成"
else
echo "安装ELRepo仓库的yum源失败,正在退出..."
exit 1
fi
yum -y --enablerepo=elrepo-kernel install kernel-ml
if [ $? = 0 ];then
echo "安装最新版本内核完成"
else
echo "安装最新版本内核失败,正在退出..."
exit 1
fi
grub2-set-default 0
if [ $? = 0 ];then
echo "设置最新版本内核完成"
else
echo "设置最新版本内核失败,正在退出..."
exit 1
fi
grub2-mkconfig -o /boot/grub2/grub.cfg
if [ $? = 0 ];then
echo "设置 grub2完成"
else
echo "设置 grub2失败,正在退出..."
exit 1
fi
echo "查看系统上的所有可用内核："
sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
